package tp.pr5.items;

import tp.pr5.NavigationModule;
import tp.pr5.RobotEngine;

/**
 * The superclass of every type of item. 
 * It contains the common information for all the items and it defines the interface that the items must match
 *
 */
public abstract class Item 
{
	
	private String id;
	private String description;
	
	/**
	 * Builds an item from a given identifier and description
	 * 
	 * @param id
	 * @param description
	 */
	public Item(String id, String description) 
	{
		this.id = id;
		this.description = description;
	}
	
	/**
	 * 	Try to use the item with a robot in a given place. It returns whether the action was completed. Subclasses must override this method
	 * 
	 */
	public abstract boolean canBeUsed();
	
	/**
	 * 	Checks if the item can be used. Subclasses must override this method
	 * 
	 * @param r
	 * @param p
	 */
	public abstract boolean use(RobotEngine r, NavigationModule nav);
	
	/**
	 * Returns id name from item 
	 * 
	 * @return string full description of item id
	 *
	 */
	public String getId() 
	{
		return this.id;
	}
	
	/**
	 * Returns description name from item 
	 * 
	 * @return string full description of item id
	 *
	 */
	public String toString()
	{
		return this.description;
	}
	
	public abstract boolean canBeDefused();
	
	public abstract int explode();
	
}
